package com.ljw.util;

import org.apache.commons.lang3.StringUtils;

/**
 * @author lijunwei
 * @date 2025/5/21
 */
public enum RuleRelationTypeEnum {

    AND("and", "且的关系"),
    OR("or", "或的关系");

    private String relationCode;
    private String relationDesc;

    RuleRelationTypeEnum(String relationCode, String relationDesc) {
        this.relationCode = relationCode;
        this.relationDesc = relationDesc;
    }

    public String getRelationCode() {
        return relationCode;
    }

    public String getRelationDesc() {
        return relationDesc;
    }


    public static RuleRelationTypeEnum getRelationVyCode(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        for (RuleRelationTypeEnum value : RuleRelationTypeEnum.values()) {
            if (value.getRelationCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

}

